package com.atguigu.srb.core.controller.admin;

import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.vo.BorrowInfoApprovalVO;
import com.atguigu.srb.core.service.BorrowInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: Bright
 * @Date: 2022-04-24 11:16
 * @Description: com.atguigu.srb.core.controller.admin
 * @version: 1.0
 */
@Slf4j
@Api(tags = "借款管理")
@RestController
@RequestMapping("/admin/core/borrowInfo")
public class AdminBorrowInfoController {
    @Resource
    BorrowInfoService borrowInfoService;

    @ApiOperation(value = "得到借款列表")
    @GetMapping("/list")
    public R list(){
       return R.ok().data("list", borrowInfoService.fatchData());
    }

    @ApiOperation(value = "得到借款详情")
    @GetMapping("/show/{id}")
    public R show(@PathVariable Long id ){
      return R.ok().data("borrowInfoDetail",borrowInfoService.getBorrowInfoDetailById(id)) ;
    }

    @ApiOperation(value = "借款操作")
    @PostMapping("/approval")
    public R approval(@RequestBody BorrowInfoApprovalVO borrowInfoApprovalVO){
        borrowInfoService.appeoval(borrowInfoApprovalVO);

        return R.ok();

    }

}



